home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-12-22 | 2.7 KB | 62 lines | [TEXT/GEOL] |
- Item 2254443 22-Dec-89 11:53
-
- From: ROSENSTEIN1 Rosenstein, Larry
-
- To: MACAPP.TECH$ MacApp Technical
- MADA2 MacApp Dev Assoc, Curtis Faith
-
- Sub: RE>Memory Clarifications
-
- Attn: MacApp Tech
- Attn: MacApp Dev Assoc, Curtis Faith
- SentBy: Larry Rosenstein
- Date 12/22/89
- Subject RE>Memory Clarifications
- From Larry Rosenstein
- To MacApp Dev Assoc, Curtis Faith
- MacApp Tech
-
- Reply to: RE>Memory Clarifications
- Curtis,
-
- I think it is more correct to say permanent memory is permanent because that
- memory is controlled by the user. It is up to the user to free that memory by
- deleting something from the document. Temporary memory is memory under
- control of the application, since it can purge code segments, etc.
-
- The handles you create are not tagged in anyway to distinguish them.
- Permanent and temporary memory is distinguished by the setting of the
- PermAllocation flag at the time you call the Memory Manager. So it is
- necessary to call PermAllocation(TRUE) before calling SetHandleSize if the
- handle you are resizing is part of the document's data. That's because if you
- are making the handle larger, then you need some additional "permanent"
- memory, and the only way for MacApp to know this is by the setting of the
- PermAllocation flag. The same is true of HandToHand.
-
- The setting of the PermAllocation flag controls what MacApp does if it runs
- out of memory. If PermAllocation is FALSE, then MacApp will deallocate its
- temporary reserve to try to ensure that the request succeeds. (That's because
- a temporary allocation must succeed.) If the flag is TRUE then MacApp won't
- deallocate this reserve and the allocation might fail.
-
- The only reason MacApp keeps a list of temporary handles is to better optimize
- the memory usage. You tell MacApp the maximum amount of temporary memory your
- program uses, and MacApp ensure that this memory is always available. Any
- temporary handles already allocated counts towards this total.
-
- If you allocate a 10K temporary handle that isn't on MacApp's list, then
- MacApp won't know that this is temporary and that 10K won't count towards
- satisfying the application's temporary memory requirements. The result is
- that MacApp may make the temporary reserve 10K higher than it really needs to
- be. In most cases, this won't be a problem.
-
- To summarize. I think you need to set the PermAllocation flag to TRUE if you
- do any call that allocates permanent memory that belongs to the document. I
- don't think you need to worry about adding to MacApp's temporary memory list,
- unless you are allocating lots (~50-100K) of temporary memory and keeping this
- memory around for a long time.
-
- Larry Rosenstein
-
-
-